

package cardval.dao;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import cardval.entity.CardInfoTransLog;

/** 
* @ClassName: CardTransLogDao 
* @Description: TODO
* @author Renne66  465119455@qq.com
* @date 2016年4月29日 上午10:21:05 
*  
*/
@Repository("cardTransLogDao")
public class CardTransLogDao {
	private static final Logger logger = Logger.getLogger(CardTransLogDao.class);
	@Resource
	private JdbcTemplate jdbcTemplate;
	
	/**
	 * 添加卡信息到交易日志表中去的
	 * @param paramsCard
	 * @return
	 */
	public int addCardTransLog(CardInfoTransLog paramsCard){
		//新增流水号和商户号
		String sql = "INSERT INTO t_translog (SERIALNO,PARTNERNO,CARDNO,NAME,MOBILE,IDCARD,rspCd,rspDesc,TIN,TRANSIN,TRANSOUT,TOUT,STTIME,TRTIME,TOLTIME) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		List<Object> list = new ArrayList<>();
		list.add(paramsCard.getSERIALNO());
		list.add(paramsCard.getPARTNERNO());
		list.add(paramsCard.getCARDNO());
		list.add(paramsCard.getNAME());
		list.add(paramsCard.getMOBILE());
		list.add(paramsCard.getIDCARD());
		list.add(paramsCard.getRspCd());
		list.add(paramsCard.getRspDesc());
		list.add(paramsCard.getTIN());
		list.add(paramsCard.getTRANSIN());
		list.add(paramsCard.getTRANSOUT());
		list.add(paramsCard.getTOUT());
		list.add(paramsCard.getSTTIME());
		list.add(paramsCard.getTRTIME());
		list.add(paramsCard.getTOLTIME());
		logger.info("-------------------------------addCardTransLog:"+sql);
		logger.info("addCardTransLog:"+list.toString());
		return jdbcTemplate.update(sql, list.toArray());
	}
	
	//更新时间点的操作update
	 public int updateTransLogTime(String time1,String time2,String time3,String time4) {
	        String sql = "UPDATE t_translog SET TRANSIN = ? ";
	        List<Object> list = new ArrayList<Object>();
	        list.add(time2);
	        logger.info("updatePartnersMoney:" + sql);
	        logger.info("updatePartnersMoney:" + list.toString());
	        return jdbcTemplate.update(sql, list.toArray());
	    }

}
